Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
additional .htaccess in subfolder | mod_rewrite for query parameter

I have a little mod_rewrite problem and really need some help.

I need to have a second .htaccess file in a subfolder for a project on my domain.

The URL to the project is like:

https://example.com/project-name/

Now I have a query parameter for which I want to create a nice URL with mod_rewrite.

The URL including the parameter looks like this:

https://example.com/project-name/index.php?preset=nameofapreset

And I want it to be:

https://example.com/project-name/nameofapreset

The important thing: The mod_rewrite has to work for the current folder only. Without having any info about the current path, cause I need to use the file in other folders, too.

That's what I thought should work (cause I am using a similar rewrite rule in another project):

RewriteEngine On
RewriteRule ^([a-z])/?$ index.php?preset=$1

But it doesn't. And all my trials fail.

Any ideas how I can make it work?

Thanks!

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You can use this rule in /project-name/.htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/?$ index.php?preset=$1 [L,QSA]
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda